#--- path
BIN_DIR   = ../../bin
INC_DIR   = 

#--- 
EXEC = synit fraig ic3 luteco_test 
PKGNAME   = main
EXTHDRS   = 

#--- link flag 
LINKPATH = ../../lib/ 
LINKFLAGS = 

include ../Makefile.in

target:$(patsubst %, %.out , $(EXEC))
	
clean ::
	@rm -f *.out

RWT = rewrite 
BASE= base info util 

synitmodule=$(BASE) $(RWT) 
fraigmodule=$(BASE) rewrite cktsat minisat-2.2 z
ic3module = $(BASE) rewrite cktsat z ic3 minisat-2.2
luteco_testmodule=$(BASE) $(RWT) luteco decomp cktsat minisat-2.2 z
fpga_modifymodule=$(BASE) $(RWT) luteco

%.out : %.o $(wildcard ../../lib/*.a)
	@echo "Linking $@ ... "
	@$(CXX) $(CFLAGS) $< $(patsubst %, -L%, $(LINKPATH)) $(LINKFLAGS) \
		$(patsubst %, -l% , $($*module)) $(patsubst %, -l% , $($*module)) \
		$(patsubst %, -l% , $($*module)) $(patsubst %, -l% , $($*module)) -o $@ $(PKGUSED) 
	@ln -fs ../src/main/$@ $(BIN_DIR)/$*
